package docx;

import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.Reader;

import org.jsoup.Jsoup;

public class extractTextJSoup {
	public static String extractText(Reader reader) throws IOException {
		StringBuilder sb = new StringBuilder();
		BufferedReader br = new BufferedReader(reader);
		String line;
		while ((line = br.readLine()) != null) {
			sb.append(line);
		}
		String textOnly = Jsoup.parse(sb.toString()).text();
		return textOnly;
	}

	public static void main(String[] args) throws Exception {
		FileReader reader = new FileReader(
				"C:/Users/nnn/Documents/eclipse/swp/ttt/sample-docs/docx/doc.html");
		System.out.println(extractText(reader));

	}

}
